package com.hq.ims.data.vo.quartz;

import com.alibaba.fastjson.annotation.JSONField;
import com.hq.ims.data.quartz.utils.QuartzUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class QuartzJobInfo implements Serializable {

    @ApiModelProperty(value = "类型")
    private String type;

    @ApiModelProperty(value = "任务名称")
    private String jobName;

    @ApiModelProperty(value = "参数")
    private String params;

    @ApiModelProperty(value = "cron日期")
    private String cronStr;

    @ApiModelProperty(value = "执行时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime fireDate;

    @ApiModelProperty(value = "处理类")
    private Class cls;

    public QuartzJobInfo(String type, String jobName, String params, LocalDateTime fireDate, Class cls) {
        this.type = type;
        this.jobName = jobName;
        this.params = params;
        this.fireDate = fireDate;
        this.cls = cls;
        this.setCronStr(QuartzUtils.getCronStr(fireDate));
    }

}
